package com.fuxin.hanfu.uitls;

import lombok.Data;

@Data
public class Result {
    private static final String SUCCESS = "0";
    private static final String Error = "-1";

    // 类的属性
    private String code;
    private String msg;
    private Object data;

    //自定义方法
    public static Result success() {
        Result result = new Result();
        result.setCode(SUCCESS);//把success的值设置为code的值
        return result;
    }

    public static Result success(Object data) {
        Result result = new Result();
        //设置code 和数据
        result.setCode(SUCCESS);
        result.setData(data);
        return result;
    }

    public static Result error(String msg){
        Result result = new Result();
        //设置code 和报错信息
        result.setCode(Error);
        result.setMsg(msg);
        return result;
    }
}
